import types from "../types";
import axios from 'axios'

const state = {
  huodong: []
}

const getters = {
  activity(state) {
    return state.huodong
  }
}

const actions = {
  getActivity({commit, state}) {
    axios.get('api/huodong').then(resp => {
      if (resp.data.errno == 0) {
        commit(types.GET_ACTIVITY, resp.data.data)
      }
    })
  }
}

const mutations = {
  [types.GET_ACTIVITY](state, data) {
    state.huodong = data
  }
}

export default {
  state,
  getters,
  actions,
  mutations
}
